<style type="text/css">
    .demo-upload-list {
        display: inline-block;
        width: 60px;
        height: 60px;
        text-align: center;
        line-height: 60px;
        border: 1px solid transparent;
        border-radius: 4px;
        overflow: hidden;
        background: #fff;
        position: relative;
        box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
        margin-right: 4px;
    }

    .demo-upload-list img {
        width: 100%;
        height: 100%;
    }

    .demo-upload-list-cover {
        display: none;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, .6);
    }

    .demo-upload-list:hover .demo-upload-list-cover {
        display: block;
    }

    .demo-upload-list-cover i {
        color: #fff;
        font-size: 20px;
        cursor: pointer;
        margin: 0 2px;
    }

    .selected-search {
        box-shadow: 0 1px 6px rgba(0, 0, 0, .2);
        height: 200px;
        width: 260px;
        position: relative;
        border-radius: 4px;
    }

    .selected-search .search-action {
        position: absolute;
        top: 10px;
        left: 10px;
        right: 10px;
    }

    .selected-search .selected-arr {
        position: absolute;
        top: 50px;
        left: 20px;
        right: 20px;
        bottom: 10px;
        overflow: scroll;
    }

    .select-click {
        border: 1px solid #dddee1;
        border-radius: 4px;
        padding: 0 10px;
        margin-bottom: 10px;
    }

    .selected-search .selected-arr .selected-item {
        /*border-bottom: 1px solid #dfdfdf;*/
    }
</style>
<template>
    <i-form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="100">
        <Form-item label="一卡通编号" prop="cardid">
            <i-input v-model="formValidate.cardid" placeholder="请输入一卡通编号(非必填)"></i-input>
        </Form-item>
        <Form-item label="证件类型" prop="papertype">
            <i-select v-model="formValidate.papertype" placeholder="请选择证件类型(非必填)">
                <template v-for="(item,index) in papertypeArr">
                    <i-option :value="item.Value">{{item.Value}}</i-option>
                </template>
            </i-select>
        </Form-item>
        <Form-item label="证件号" prop="Paperid">
            <i-input v-model="formValidate.Paperid" placeholder="请输入证件号(非必填)"></i-input>
        </Form-item>
        <Form-item>
            <i-button @click="handleSubmit('formValidate')" type="primary">下一步(可跳过)</i-button>
            <i-button   style="margin-left: 8px">取消</i-button>
        </Form-item>
    </i-form>

</template>
<script>
    import apiUtil from '../../assets/utils/api_util';

    export default {
        data() {
            return {
                formValidate: {
                    cardid: '',//一卡通id
                    Paperid: '',
                    Papertype: '',
                },
                ruleValidate: {},
                papertypeArr: [],
                keyword: '',
            }
        },
        mounted: function () {
            this.getPaperData();
        },

        methods: {

            handleSubmit(name) {

                let that = this;
                let model = this.$refs[name].model;
                this.$refs[name].validate((valid) => {
                    that.addData(model);
                })
            },
            //获取证件类型
            getPaperData() {
                let that = this;

                let para = {};
                let params = that.$qs.stringify(para);

                this.$Loading.start();

                apiUtil.get(that, apiUtil.urls.paperTypeList, params, function (res) {
                    that.$Loading.finish();
                    that.papertypeArr = res.Msg;

                });

            },
            //添加
            addData: function (model) {
                let that = this;

                model.id = this.$route.query.id;
                model.headimgurl = this.imagePost[0];
                let params = that.$qs.stringify(model);
                this.$Loading.start();

                apiUtil.post(that, apiUtil.urls.userCreateStep2, params, function (res) {
                    that.$Loading.finish();

                    let route = {
                        path: 'UserAdd3',
                        query: {
                            id: that.$route.query.id
                        },
                    };

                    that.$router.push(route);

                });
            },

        }
    }
</script>
